<cfscript>    
    view = createObject("component", session.rootDir & ".views.layout");
    if( Session.Auth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR or Session.Manager) ){
        view.init("Step 3:  HR - Orientation",
            "/jquery/ui-1.8.5/jquery-ui.min.js,/jquery/plugins/scrollTo/jquery.scrollTo-1.4.2-min.js, /" & session.rootDir & "/static/js/SCF/Step3-EmergencyContacts.js",
            "/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css","Home",index);
    }else{
        view.init("Denied","","","Home","Denied");
    }    
    view.html();
</cfscript>

<cffunction name="index" access="public" output="true" returntype="any">

    <!--- if the employee to hire isn't specified, redirect to Step 2 - Page 1 --->
    <cfif not isdefined("URL.StepID")>
        <cflocation url="/#Session.RootDir#/status.cfm" addtoken="no">
    </cfif>
    
    <cfscript>
        import models.*;
        FormAction = '/' & Session.RootDir & '/controller/SubmitHandler.cfm?SCFStep3-Beneficaries=add';
        FormActionComplete = '/' & Session.RootDir & '/controller/SubmitHandler.cfm?SCFStep3=complete';
        KronosQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.Kronos");
        AccessControlQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.AccessControl");
        JustinsJobProg = CreateObject("component", session.rootDir & ".DatabaseQueries.JustinsJobProg");
        StepAction = entityLoadByPK("StepActions", URL.StepID);
        Employee = entityLoadByPK("Employee", StepAction.getEmployeeID());
        Lunch = entityLoadByPK("Lunch", Employee.getLunchID());
        GetShifts = entityload("Shift");
        GetLunches = entityload("Lunch");
        GetDepts = KronosQueries.funcGetDepts( employee.getDepartmentID() );
        GetEthnicCodes =  KronosQueries.funcGetEthnicCodes();
        GetMaritalCodes = KronosQueries.funcGetMaritalCodes();
        GetGenderCodes = KronosQueries.funcGetGenderCodes();
        GetI9Codes = KronosQueries.funcGetI9Codes();
        GetPositionInfo = KronosQueries.funcGetPositionCodes(Employee.getPositionID());
        GetStates = KronosQueries.funcGetStates();
        GetPhoneTypes = KronosQueries.funcGetPhoneTypes();
        GetRelations = KronosQueries.funcGetRelations();
    </cfscript>
    
    <cfoutput> 
    
        <h1 class="title">Step 3:  HR - Orientation - Emergency Contacts</h1>
        <div class="entry">
            On this page we'll capture additional information obtained by HR from the employee during Orientation, specifically Emergency Contacts.<br /><br />
            
            <cfform name="frmStep3" method="post">
                <table cellpadding="0" cellspacing="0" width='100%'>
                    <tr>
                        <td>Employee:</td>
                        <td>#Employee.getFullName()#</td>
                    </tr>
                    <tr>
                        <td>Position:</td>
                        <td>#GetPositionInfo.PositionCodeDescription# ( #GetPositionInfo.PositionCode# )</td>
                    </tr>
                    <tr>
                        <td>Department:</td>
                        <td>#GetDepts.Org#</td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <fieldset>
                                <legend>Emergency Contacts</legend>
                                <table id="EmergencyContacts" width="100%">
                                    <tr>                                 
                                        <td width="100%" id="emergency_contacts_body">
                                            <table>
                                                <tr>
                                                    <td width='10'>&nbsp;</td>
                                                    <td nowrap='nowrap'>First &amp; Last Name: </td>                                                   
                                                    <td width='100%'>                                                            
                                                        <input name="First" id="First" maxlength="25" type="text" error_message='Please provide a First Name.'> 
                                                        <input name="Last" id="Last" maxlength="25" type="text"  error_message='Please provide a Last Name.'>                                                 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width='10'>&nbsp;</td>
                                                    <td valign='top'>Address:</td>
                                                    <td>                                                        
                                                        <input name="Address1" id="Address1" maxlength="50" style="width: 98%;margin-bottom:3px" type="text"><br />
                                                        <input name="Address2" id="Address2" maxlength="50" style="width: 98%;" type="text">                                                 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width='10'>&nbsp;</td>
                                                    <td nowrap='nowrap'>City, ST, ZIP:</td>
                                                    <td nowrap="nowrap">
    
                                                        <input name="City" id="City" style="width: 50%;" type="text"> 
                                                        <select name="State" id="State">
                                                            <cfloop query="GetStates">
                                                                <option value="#LocalCodeIdNo#" >#LocalCodeAbbreviation#</option>
                                                            </cfloop>
                                                        </select> 
                                                        <input name="Zip" id="Zip" maxlength="10" size="14" type="text"> 
                                                
                                                    </td>
                                                </tr>
                                               <TR>
                                                    <td width='10'>&nbsp; </td>
                                                    <TD nowrap=nowrap valign="top">Phones:</TD>
                                                    <TD colspan=3>
                                                        <fieldset style="border:inset">
                                                            <table>
                                                                <TR>
                                                                    <td width =10>&nbsp;</td>
                                                                    <TD>Primary:&nbsp;</TD>
                                                                    <td>                                                                                                                                            
                                                                        <select name="PhonePrimaryID" id="PhonePrimaryID">
                                                                            <cfloop query="GetPhoneTypes">
                                                                                <option value="#TypeCodeIdNo#" >#TypeCode#</option>
                                                                            </cfloop>
                                                                        </select> 
                                                                    </td>
                                                                </TR>
                                                                <tr>
                                                                    <td width =10>&nbsp;</td>
                                                                    <td nowrap=nowrap>Home Phone:</td>
                                                                    <td>
                                                                        <input type="text" maxlength="14" id="HomePhone" name="HomePhone" error_message="The valid home phone format is xxx-xxx-xxxx.">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td width =10>&nbsp;</td>
                                                                    <td nowrap=nowrap>Cell Phone:</td>
                                                                    <td>
                                                                        <input type="text" maxlength="14" id="CellPhone" name="CellPhone" error_message="The valid cell phone format is xxx-xxx-xxxx.">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td width =10>&nbsp;</td>
                                                                    <td nowrap=nowrap>Work Phone:</td>
                                                                    <td>
                                                                        <input type="text" maxlength="14" id="WorkPhone" name="WorkPhone" error_message="The valid work phone format is xxx-xxx-xxxx.">
                                                                        x
                                                                        <input type="text" size="7" maxlength="6" id="WorkPhoneExt" name="WorkPhoneExt">    
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </fieldset>
                                                    </TD>
                                                </TR>
                                                <tr>
                                                    <td width =10>&nbsp;</td>                    
                                                    <td>Contact Email:</td>
                                                    <td>
                                                        <input type="text" style="width: 98%;" maxlength="50" id="Email" name="Email">
                                                    </td>
                                                </tr>
                                                <TR>
                                                    <td width =10>&nbsp;</td>
                                                    <TD nowrap=nowrap>Relation:</TD>
                                                    <TD colspan=3>
                                                        <select id="RelationID" name="RelationID">
                                                            <cfloop query="GetRelations">
                                                                <option value="#RelationCodeIDNo#">#RelationCode#</option>
                                                            </cfloop>
                                                        </select>
                                                    </TD>
                                                </TR>
                                            </table>
                                        </td>
                                    </tr>                
                                </table>     
                            </fieldset>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5" align="right">
                            <a href="##" class="tablemod" id="more_emergency_contacts" >CLICK HERE to add another Emergency Contact</a>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5" align="right" valign="middle" style="padding-top:5px;">
                            <cfinput type="hidden" name="EmpID" value="#Employee.getEmployeeID()#">
                            <cfinput type="hidden" name="StepID" value="#URL.StepID#">
                            <cfinput type="hidden" name="FormAction" value="#FormAction#">
                            <cfinput type="hidden" name="FormActionComplete" value="#FormActionComplete#">
                            <cfinput type="button" name="Skip" value="Skip >>">
                            <cfinput type="button" name="Submit" value="Next >>" >
                        </td>
                    </tr>
                </table>
            </cfform>
            
            <table id="protoHTML" style="display:none">
                <tr>                                 
                    <td width="100%" >
                        <table>
                            <tr>
                                <td width='10'>&nbsp;</td>
                                <td nowrap='nowrap'>First &amp; Last Name: </td>                                                   
                                <td width='100%'>                                                            
                                    <input name="First" id="First" maxlength="25" type="text" error_message='Please provide a First Name.'> 
                                    <input name="Last" id="Last" maxlength="25" type="text" error_message='Please provide a Last Name.'>                                                 
                                </td>
                            </tr>
                            <tr>
                                <td width='10'>&nbsp;</td>
                                <td valign='top'>Address:</td>
                                <td>                                                        
                                    <input name="Address1" id="Address1" maxlength="50" style="width: 98%;margin-bottom:3px" type="text"><br />
                                    <input name="Address2" id="Address2" maxlength="50" style="width: 98%;" type="text">                                                 
                                </td>
                            </tr>
                            <tr>
                                <td width='10'>&nbsp;</td>
                                <td nowrap='nowrap'>City, ST, ZIP:</td>
                                <td nowrap="nowrap">
                
                                    <input name="City" id="City" style="width: 50%;" type="text"> 
                                    <select name="State" id="State">
                                        <cfloop query="GetStates">
                                            <option value="#LocalCodeIdNo#" >#LocalCodeAbbreviation#</option>
                                        </cfloop>
                                    </select> 
                                    <input name="Zip" id="Zip" maxlength="10" size="14" type="text"> 
                            
                                </td>
                            </tr>
                           <TR>
                                <td width='10'>&nbsp; </td>
                                <TD nowrap=nowrap valign="top">Phones:</TD>
                                <TD colspan=3>
                                    <fieldset style="border:inset">
                                        <table>
                                            <TR>
                                                <td width =10>&nbsp;</td>
                                                <TD>Primary:&nbsp;</TD>
                                                <td>                                                                                                                                            
                                                    <select name="PhonePrimaryID" id="PhonePrimaryID">
                                                        <cfloop query="GetPhoneTypes">
                                                            <option value="#TypeCodeIdNo#" >#TypeCode#</option>
                                                        </cfloop>
                                                    </select> 
                                                </td>
                                            </TR>
                                            <tr>
                                                <td width =10>&nbsp;</td>
                                                <td nowrap=nowrap>Home Phone:</td>
                                                <td>
                                                    <input type="text" maxlength="14" id="HomePhone" name="HomePhone" error_message="The valid home phone format is xxx-xxx-xxxx.">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width =10>&nbsp;</td>
                                                <td nowrap=nowrap>Cell Phone:</td>
                                                <td>
                                                    <input type="text" maxlength="14" id="CellPhone" name="CellPhone" error_message="The valid cell phone format is xxx-xxx-xxxx.">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width =10>&nbsp;</td>
                                                <td nowrap=nowrap>Work Phone:</td>
                                                <td>
                                                    <input type="text" maxlength="14" id="WorkPhone" name="WorkPhone" error_message="The valid work phone format is xxx-xxx-xxxx.">
                                                    x
                                                    <input type="text" size="7" maxlength="6" id="WorkPhoneExt" name="WorkPhoneExt">    
                                                </td>
                                            </tr>
                                        </table>
                                    </fieldset>
                                </TD>
                            </TR>
                            <tr>
                                <td width =10>&nbsp;</td>                    
                                <td>Contact Email:</td>
                                <td>
                                    <input type="text" style="width: 98%;" maxlength="50" id="Email" name="Email">
                                </td>
                            </tr>
                            <TR>
                                <td width =10>&nbsp;</td>
                                <TD nowrap=nowrap>Relation:</TD>
                                <TD colspan=3>
                                    <select id="RelationID" name="RelationID">
                                        <cfloop query="GetRelations">
                                            <option value="#RelationCodeIDNo#">#RelationCode#</option>
                                        </cfloop>
                                    </select>
                                </TD>
                            </TR>
                        </table>
                    </td>
                </tr>
            </table>
        </div>    
    </cfoutput>
    
</cffunction>